package com.ebupt.migu.music.iop.mapper;

import com.ebupt.migu.music.iop.pojo.RowCount;
import lombok.extern.slf4j.Slf4j;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
import org.springframework.data.hadoop.hbase.RowMapper;

/**
 * @author tz
 */
@Slf4j
public class RowCountMapper implements RowMapper<RowCount> {

    private static byte[] CF = "cf".getBytes();

    @Override
    public RowCount mapRow(Result result, int rowNum) {
        RowCount pojo = new RowCount();
        pojo.setTagName(Bytes.toString(result.getValue(CF,"tagName".getBytes())));
        pojo.setActiveIdsCount(Bytes.toString(result.getValue(CF,"activeIdsCount".getBytes())));
        pojo.setPhoneCount(Bytes.toString(result.getValue(CF,"phoneCount".getBytes())));
        return pojo;
    }
}
